{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item" >

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <input type="text" id="user_create_id" class="layui-input search" name="user_create_id" placeholder="用户ID"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <input type="text" id="user_phone" class="layui-input search" name="user_phone" placeholder="手机号"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <input type="text" id="user_real_name" class="layui-input search" name="user_real_name" placeholder="真实姓名"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <select name="user_status" lay-search="">
                                <option  value="">不限账号状态</option>
                                <option  value="1">正常</option>
                                <option  value="3">冻结</option>
                                <option  value="4">注销</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <select name="user_gender" lay-search="">
                                <option  value="">不限性别</option>
                                <option  value="1">男</option>
                                <option  value="2">女</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <select name="user_real_check" lay-search="">
                                <option  value="">不限认证状态</option>
                                <option  value="1">未认证</option>
                                <option  value="2">已认证</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <select name="user_is_tuijian_like" lay-search="">
                                <option  value="">不限推荐状态</option>
                                <option  value="1">未推荐</option>
                                <option  value="2">已推荐</option>
                            </select>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <input type="text"  name="start_time" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="注册开始日期"/>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <input type="text"  name="end_time" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="注册结束日期"/>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <!--<button class="btn btn-primary" type="button" onclick="wk.href('{:url('bannerAdd')}');">-->
                            <!--<i class="fa fa-plus"></i> 添加轮播图-->
                        <!--</button>-->
                        <button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">
                            <i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">
                            <!--<li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchClose"><i class="fa fa-check-circle"></i> 批量关闭订单</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchDel"><i class="fa fa-ban"></i> 批量删除订单</a></li>-->
                            <li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 批量导出</a></li>
                            <li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>
                        </ul>
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>

                    <!--图片模板-->
                    <!--<script type="text/html" id="imgTpl">-->
                        <!--<img src="{{d.banner_thumb}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"/>-->
                    <!--</script>-->

                    <!--状态显示模板-->
                    <script type="text/html" id="gender">
                        {{# if(d.user_gender == 1){ }}
                        <span style="color: blue">男</span>
                        {{# } }}
                        {{# if(d.user_gender == 2){ }}
                        <span style="color: red">女</span>
                        {{# } }}
                    </script>

                    <script type="text/html" id="statBar">
                        {{# if(d.user_status == 1){ }}
                        <span style="color: green">正常</span>
                        {{# } }}
                        {{# if(d.user_status == 3){ }}
                        <span style="color: red">已冻结</span>
                        {{# } }}
                        {{# if(d.user_status == 4){ }}
                        <span style="color: red">已注销</span>
                        {{# } }}
                    </script>

                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.layer_show('详情','{:url('userDetail')}?user_id={{d.user_id}}')" class="btn btn-warning btn-xs m-r-xs" title="详情"><i class="fa fa-search">详情</i></a>
                        <!--<a href="javascript:;" onclick="wk.href('{:url('bannerEdit')}?banner_id={{d.banner_id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑"><i class="fa fa-pencil">编辑</i></a>-->
                        {{# if(d.user_status == 1) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('userFreeze')}', '确定冻结？')" class="btn btn-default btn-xs m-r-xs" title="冻结"><i class="fa fa-arrow-down">冻结</i></a>
                        {{# } }}
                        {{# if(d.user_status == 3) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('userStartUsing')}', '确定解冻？')" class="btn btn-primary btn-xs m-r-xs" title="解冻"><i class="fa fa-arrow-up">解冻</i></a>
                        {{# } }}
                        {{# if(d.user_status == 4) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('userStartRecover')}', '确定恢复？')" class="btn btn-primary btn-xs m-r-xs" title="恢复"><i class="fa fa-arrow-up">恢复</i></a>
                        {{# } }}
                        {{# if(d.user_is_tuijian_like == 1) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('userCommend')}', '确定设置推荐？')" class="btn btn-info btn-xs m-r-xs" title="设置推荐"><i class="fa fa-star">设置推荐</i></a>
                        {{# } }}
                        {{# if(d.user_is_tuijian_like == 2) { }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('userUncommend')}', '确定取消推荐？')" class="btn btn-warning btn-xs m-r-xs" title="取消推荐"><i class="fa fa-star-o">取消推荐</i></a>
                        {{# } }}
                        <!--<a href="javascript:;" onclick="wk.confirm('{{d.banner_id}}','{:url('bannerDel')}')" class="btn btn-danger btn-xs m-r-xs" title="删除"><i class="fa fa-trash-o">删除</i></a>-->
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Member/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                  {type: 'checkbox', fixed: 'left'}
                , {type:'numbers', width: 60, title: '序号'}
                , {field: 'user_create_id', width: 100, title: 'ID', align: 'center'}
                , {field: 'user_username', width: 140, title: '昵称', align: 'center'}
                , {field: 'user_real_name', width: 100, title: '真实姓名', align: 'center'}
                , {field: 'user_gender', width: 60, title: '性别', align: 'center', toolbar: '#gender'}
                , {field: 'user_phone', width: 120, title: '手机号', align: 'center'}
                , {field: 'user_email', width: 180, title: '邮箱', align: 'center'}
                , {field: 'user_time', width: 160, title: '注册时间', align: 'center'}
                , {field: 'club_name', width: 100, title: '俱乐部', align: 'center'}
                , {field: 'user_urg_phone', width: '', title: '紧急联系人手机号', align: 'center'}
//                , {field: 'banner_img', width: 90, title: '缩略图', align: 'center', templet: '#imgTpl'}
                , {field: 'user_status', width: 80, title: '状态', align: 'center', toolbar: '#statBar'}
                , {fixed: 'right', width: 250, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('#allidsForOut').val(res.count2);
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });


        //批量操作
        var $ = layui.$, active = {
            //批量导出订单
            excelAll:function () {
                wk.excelAll(getIds(),$('.layui-input').serialize(),"{:url('outExcel')}");
            },
            //全部导出
            excelAllNoSelect:function () {
                wk.excelAllNoSelect($('#allidsForOut').val(),$('.layui-input').serialize(),"{:url('outExcel')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['user_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>